<script setup>
import locale from 'ant-design-vue/es/locale/zh_CN';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import { provide, ref } from 'vue';
import { REQU } from './net/requ.js';

dayjs.locale('zh-cn');

/** 鉴权 */
const auth = ref(!$config.needCheckAuth);
provide('auth', auth);

/** code=0 则鉴权过期 */
function checkInvoke() {
  return REQU('/api/web/checkInvoke', { method: 'POST' }).then(R.compose( R.not, R.equals(0), R.prop('data') ));
}

function main() {
  $config.needCheckAuth && checkInvoke().then(value => (auth.value = value));
}

main();
</script>

<template>
  <a-config-provider :locale="locale">
    <router-view></router-view>
  </a-config-provider>
</template>
